﻿using Kele.Core.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;

namespace Kele.Core.Mvc
{
    [ApiController]
    [Route("api/[controller]")]
    public class ApiController : ControllerBase
    {
        protected ILogger Logger => HttpContext.RequestServices.GetLogger(GetType());

        protected IActionResult OkResult()
        {
            return NoContent();
        }

        protected IActionResult OkResult(object value)
        {
            return Ok(value);
        }

        protected IActionResult ErrorResult(string error)
        {
            return new JsonResult(error) { StatusCode = 400 };
        }
    }
}